The following example is to work with turtlesim node which is attached in ROS packages.
catkin_makeRun the ROS master node:
roscorerosrun turtlesim turtlesim_nodeAfter running this command, you'll see a graphical representation for turtle.
You'll notice that you can't control turtle movement.
There is a built-in feature turtle_teleop_key that takes the keyboard input from the user and convert it to ROS msg that controls the turtle position:
rosrun turtlesim turtle_teleop_keyNow, you can control the turtle's position from your keyboard.
Take a look on the image below for drawing triangle using the turtle.
Listing the nodes:
rosnode listrosnode info /turtlesimListing the topics:
rostopic listListing the turtle command velocity topic:
rostopic info /turtle1/cmd_velNotice that the messages type of cmd_vel topic is geometry_msgs/Twist
rosmsg show geometry_msgs/TwistExplore info for Pose messages in turtlesim node.
Try to figure out the purpose of this command:
rostopic echo /turtle1/cmd_vel